package controllers;

import helpers.ExampleHelper;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import data.AutoSiteData;
import data.BlogData;
import data.MessageQueueData;

import models.AutoSite;
import models.Blog;

public class CreateExampleData extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws IOException {
		//Insert blog
		Blog blog = ExampleHelper.insertBlog();
		BlogData.insert(blog);
		
		//Insert autosite toucharcade
		AutoSite autoSite = ExampleHelper.insertAutoSiteToucharcade();
		AutoSiteData.insert(autoSite);
		
		//Insert autosite iphoneAppstorm
		ArrayList<AutoSite> list = ExampleHelper.insertIphoneAppstorm();
		for (int i = 0; i < list.size(); i++) {
			autoSite = list.get(i);
			AutoSiteData.insert(autoSite);
		}
		
//		MessageQueueData.deleteAll();
		
		response.getWriter().println("Create example data success!");
	}
}
